var web = require("../../utils/buildingListWeb.js");
Page({
  data: {
    // 是否模拟开盘
    isMoni: my.getStorageSync({ key: 'isMoni' }).data,

    buildingList: [],
    // 是否能第二次点击
    secondClick: true
  },
  onShow() {
    web.client.getTaskList(this);
  },
  onPullDownRefresh() {
    web.client.getTaskList(this);
  },
  onItemClick(ev) {
    // 如果不能点击，则直接返回
    if (!this.data.secondClick) {
      return;
    }
    this.setData({ secondClick: false });
    console.log("taskId   ", this.data.buildingList[ev.index].taskId);
    my.setStorageSync({ key: 'taskId', data: this.data.buildingList[ev.index].taskId });
    my.setStorageSync({ key: 'chooseStrategy', data: this.data.buildingList[ev.index].chooseStrategy });
    var taskType = "房";
    // 0 选房 1 选车位 2 选房测试 3 选车位测试
    if (this.data.buildingList[ev.index].taskType == 1 || this.data.buildingList[ev.index].taskType == 3) {
      taskType = "车位";
    }
    my.setStorageSync({ key: 'taskType', data: taskType });
    web.client.taskLogin(this.data.buildingList[ev.index].taskId, this);
  },
  onShareAppMessage() {
    return {
      title: '公证 e 选房',
      desc: '提供在线选房服务',
      path: 'pages/login/login'
    };
  }
});
